package com.esm.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.esm.service.UserService;
import com.esm.serviceimpl.UserServiceImpl;
import com.esm.utils.PrintWriterUtil;

import net.sf.json.JSONArray;

/**
 * GetAllEmpCountController
 * 获取全体员工总数
 * @author NemoWey
 *
 */
public class GetAllEmpCountController_wcj extends HttpServlet
{
	private static final long serialVersionUID = 1L;
	UserService uService = new UserServiceImpl();
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException 
	{
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException 
	{
		int rid = Integer.parseInt(req.getParameter("rid"));
		int empCount = uService.getEmpolyeesCount(rid);
		PrintWriter pw = resp.getWriter();
		JSONArray jao = new JSONArray();
		jao.add(empCount);
		PrintWriterUtil.flushJaoAndClosePrintWriter(pw, jao);
	}
}
